#define _CRT_SECURE_NO_WARNINGS 1
int missingNumber(int* nums, int numsSize)
{
    int sum1 = 0;
    int sum2 = 0;
    for (int i = 0; i <= numsSize; i++)
    {
        sum1 += i;
    }
    for (int j = 0; j < numsSize; j++)
    {
        sum2 += nums[j];
    }
    return sum1 - sum2;
}

void reverse(int* arr, int left, int right)
{
    while (left < right)
    {
        int tmp = arr[left];
        arr[left] = arr[right];
        arr[right] = tmp;
        left++;
        right--;
    }
}
void rotate(int* nums, int numsSize, int k)
{
    k %= numsSize;
    reverse(nums, 0, numsSize - k - 1);
    reverse(nums, numsSize - k, numsSize - 1);
    reverse(nums, 0, numsSize - 1);
}